package com.westar.base.businessUtil;

import com.alibaba.fastjson.JSONObject;
import com.westar.core.conf.SysConst;
import com.westar.base.util.WestarHttpUtil;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;

import java.util.HashMap;
import java.util.Map;

public class LicenseUtil {

    public static void makeDone(String actCookie, String parentPage) throws Exception {
        ViewTaskUtil.submitTask(actCookie, "9",parentPage );

        Document docP = Jsoup.parse(parentPage);

        //办理结果回传
        String affairCode = docP.select("#affairCode").attr( "value" );
        String affairId = docP.select("#id").attr( "value" );
        String shardKey = docP.select("#shardKey").attr( "value" );

        Map<String,String> formParam = new HashMap<String,String>(  );
        formParam.put("affairId",affairId);
        formParam.put("affairCode",affairCode);
        formParam.put("shardKey",shardKey);

        String url = "http://"+ SysConst.DOMAIN+"/dothingsui/affairMaterialItem/signLicenseCommentToAppId";
        String responeBody = WestarHttpUtil.postMethod(url,actCookie,formParam);
        JSONObject res = JSONObject.parseObject(responeBody);
        boolean success = res.getBoolean("success");
        if(!success){
            System.out.println("办理结果回传异常");
        }


    }
}
